package weifei.mall.entity;


import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.springframework.stereotype.Repository;


/**
 *
 * -- 商品 规格组 表
 * CREATE TABLE goods_specification_group
 * (
 *     id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
 *     goods_id BIGINT UNSIGNED NOT NULL,
 *     previous_id BIGINT UNSIGNED DEFAULT NULL COMMENT "上级规格组的ID",
 *     next_id BIGINT UNSIGNED DEFAULT NULL COMMENT "下级规格组的ID",        -- 没有下级规格组，则规格可带价格
 *     name VARCHAR(128) NOT NULL,
 *     PRIMARY KEY (id),
 *     FOREIGN KEY (goods_id) REFERENCES goods(id),
 *     FOREIGN KEY (previous_id) REFERENCES goods_specification_group(id),
 *     FOREIGN KEY (next_id) REFERENCES goods_specification_group(id)
 * );
 *
 * */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("goods_specification_group")
@Repository
public class GoodsSpecificationGroup extends Model<GoodsSpecificationGroup>
{
    @Getter
    public enum Column
    {
        ID("id"),
        GoodsID("goods_id"),
        PreviousID("previous_id"),
        NextID("next_id"),
        Name("name");

        final String name;
        Column(String name) { this.name = name; }
    }


    @TableId
    private Integer id;
    private Integer goodsId;
    private Integer previousId;
    private Integer nextId;
    private String name;

    public GoodsSpecificationGroup() {}
    public GoodsSpecificationGroup(int id) {}
}

